/* 
* @Author: Jerry-chen
* @Date:   2014-07-10 02:11:47
* @Last Modified by:   Jerry-chen
* @Last Modified time: 2014-07-13 16:37:39
*/
/* 
* @Author: Jerry-chen
* @Date:   2014-07-10 02:08:04
* @Last Modified by:   Jerry-chen
* @Last Modified time: 2014-07-10 02:08:37
*/
// 获得座位所在地的名字:如3D播放室
                $(function(){

                   
                    $('#cinema').change(function() {
                        //清除HTML代码
                        $('.seatname').empty();
                        //获得CATEID
                         var cinemaid = $(this).val();
                 $.ajax({
                        url: APP + '&c=Goods&m=ajax_select_seat',
                        type: 'post',
                        dataType: 'json',
                        data: {'cinemaid' : cinemaid},
                        success:function(seatdata){
                            //定义座位字符串
                            var seatnamev="";
                            //循环返回的数据
                            //对返回的数据判断，如果返回为0证明，没有添加数据，提示添加
                            if(seatdata==0){
                                     seatnamev +="<tr><th width='120' class='w100'>播放地址</th><td style='color:red;'>没有播放地点，请先添加</td></tr>";
                            }else{
                                   //给合外面的TRTD标签 
                                    seatnamev +="<tr><th width='120' class='w100'>播放地址</th><td>";
                                    //组合SELECT标签
                                     seatnamev +="<select name='seatid' id='seatname'>";
                                    //墨认，好让用户一选就异步出座位信息
                                    seatnamev +="<option value='0'>请选择座位所在地</option>";
                                $.each(seatdata, function(ki, vi) {
                                //循环组合属性
                                    seatnamev +="<option value='"+vi.seatid+"'"+">"+vi.seatname+"</option>";


                                 });
                                //完整TR,TD,SELECT,标签 
                                     seatnamev +="<select></td></tr>";

                            }
                            // alert(seatnamev);
                            $('.seatname').append(seatnamev);          
                        }
                     })

                    });
                });
